package com.atguigu.gmall;

import org.csource.common.MyException;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient1;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.util.ClassUtils;

import java.io.IOException;

public class FileUploadDemo {
    public static void main(String[] args) throws IOException, MyException {

        String path = ClassUtils.getDefaultClassLoader().getResource(
                "tracker-server.conf").getFile();
        ClientGlobal.init(path);

        TrackerClient trackerClient = new TrackerClient();

        TrackerServer trackerServer = trackerClient.getConnection();

        StorageClient1 storageClient1 = new StorageClient1(trackerServer,null);

        String fileId = storageClient1.upload_file1("T:\\A_尚品汇商城\\资料\\图片\\Apple11\\5f7eafcd01dd2304.jpg",
                "jpg", null);
        System.out.println(fileId);


    }
}
